package com.agnes.okhttp.lib.util;

import android.support.annotation.NonNull;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * Desc:   解决解析泛型擦除的问题
 */

public class GsonRespParser implements ParameterizedType {

    private Class rawClazz;
    private Type[] args;

    public GsonRespParser(Class rawClazz, Type[] args) {
        this.rawClazz = rawClazz;
        this.args = args != null ? args : new Type[0];
    }

    @NonNull
    @Override
    public Type[] getActualTypeArguments() {
        return args;
    }


    @NonNull
    @Override
    public Type getRawType() {
        return rawClazz;
    }

    @Override
    public Type getOwnerType() {
        return null;
    }

}
